package ModelLayer;

import java.util.ArrayList;

public class Rents {
	private static Rents instance = null;
	private static ArrayList<Rent> rents;
	
	private Rents()
	{
		rents = new ArrayList<Rent>();
    }
    
    /**
     * Singleton static implementation
     */
    public static Rents getInstance()
    {
        if(instance == null)
      {
        instance = new Rents();
      }
      return instance;
    }
   
    /**
     * Accessor and Mutator methods
     */
    
    public static void addRent(Rent _rent)
    {
        rents.add(_rent);
    }
    
    public static Rent getRent(String _id)
    {
        Rent r = new Rent();
        for(int i = 0; i<rents.size(); i++)  
        {
            if (rents.get(i).getId().equals(_id))
                r = rents.get(i);
        }
        return r;
    }
    
    public static Rent allRents(int _index)
    {
        return rents.get(_index);
    }
    
    public static int getSize()
    {
        return rents.size();
    }
}
